Repository navigation
Release package 2.0.0-rc.0 - #177
Open
codama-releases[bot] wants to merge 1 commit into
Open
codama-releases[bot] wants to merge 1 commit into
codama-releases[bot] wants to merge 1 commit into
Conversation
codama-releases
Bot
force-pushed
the
knope-release/main
branch
29 times, most recently
from
November 12, 2026 11:16
99b8461 to
12b463e
Compare
codama-releases
Bot
force-pushed
the
knope-release/main
branch
from
November 13, 2026 14:00
12b463e to
1e3399f
Compare
codama-releases
Bot
force-pushed
the
knope-release/main
branch
15 times, most recently
from
November 26, 2026 14:19
3eb2f9c to
41a8f75
Compare
codama-releases
Bot
force-pushed
the
knope-release/main
branch
5 times, most recently
from
November 27, 2026 16:46
1827e7c to
684c3e2
Compare
codama-releases
Bot
force-pushed
the
knope-release/main
branch
from
November 27, 2026 18:24
684c3e2 to
eacec11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the release workflow. Merging it publishes every crate of the workspace as
2.0.0-rc.0and creates the matching GitHub release.Breaking Changes
Add
Text,IntegerandDecimal, and rewriteDocsfor spec v2Docsis now an optionalText(a plain string or atextNode) and serialises as a single string.IntegerandDecimalhold spec v2 numeric literals as canonical base-10 strings, withDecimal::from(f64)producing the same digits as JavaScript.NodegainsTransformandText,TypeNodegainsInteger,Float,FixedPointandDuration, and the v1 nesting machinery (NestedTypeNode,#[nestable_type_node], the wrapper type nodes, the genericNodeUnionderive) is removed.Add
unit(...)number displaysdisplay(unit("SOL")), ordisplay = unit(...)inline on a number type, labels a number with a unit without scaling it, and the unit can also be a public key such as a mint address. Floats and fixed points take only this display, so anamount(...)display on them is now an error pointing tounit(...), and anamount(...)display withoutdecimalssuggests either.Build identifiers, paths, namespaces and decimals from string literals
Identifier,Path,NamespaceandDecimalconvert from string literals, so constructors take them directly, e.g.AccountNode::new("my_account", data)orFieldDiscriminatorNode::new("header.kind", 0). A literal that breaks the spec grammar panics; parse any other string withstr::parseorTryFrom<String>, which return the error instead.Build spec v2 instruction data and defaults from Rust code
The fields of an instruction are now collected into a single
datastruct instead of a list of arguments, and a contextual default such as#[codama(default_value = payer)]is injected into its field from aprovidesentry on the instruction. Rust integer and float types map tointegerTypeNodeandfloatTypeNode. Usingfield(...)on a tuple struct or variant is now an error, and anenum_discriminatorname must be a valid identifier.Emit transforms from wrapper attributes
fixed_size(...),size_prefix(...),pre_offset(...),post_offset(...),sentinel(...),hidden_prefix(...)andhidden_suffix(...)keep their syntax, but they now attach transforms to the type they wrap, innermost first, rather than producing wrapper nodes in the IDL. They can also wrap alink(...), and the prefix ofsize_prefix(...)must be aninteger(...).Fail when modules or plugins describe the same item differently
When several modules describe the same program, two nodes of the same kind and identifier with different content, or two plugins with the same namespace and different payloads, are now an error instead of one silently replacing the other. Identical duplicates still merge into one. A linked PDA seed that matches no field is also an error.
Number enum variants like Rust and apply directives where they were ignored
Frozeninenum Status { Active = 5, Frozen }is6rather than its index. A discriminant that is not an unsigned integer literal fitting au32is an error instead of being ignored.declare_id!andcodama_program!macros of a crate no longer leak into the other crates of aCodama::load_all, anddeclare_id!given a constant no longer sets the public key to the name of that constant.program(...)directive applies on amod file;declaration, at the top of a file (#![codama(program(...))]) and at the top of the crate root, where the declaration wins over the file. One on a variant or field is an error.fixed_sizeapply to type aliases, and an exported type alias that does not resolve to a type is an error.#[derive(CodamaType, CodamaAccount)], is an error, as the derives would conflict.Attributes::has_any_codama_deriveis replaced byAttributes::codama_derives.Stop dropping or misreading attributes
docsof afield(...)type reach the IDL instead of being parsed and dropped.skiprejects an argument, so#[codama(skip = false)]is an error rather than a skip, andoption(..., fixed(false))is an error rather than a fixed option.cfg_attrcondition, such as#[cfg_attr(not(target_os = "solana"), codama(...))], are read like those behind a feature, as the IDL describes every configuration.Flatten
Nodeinto one variant per node kindNodenow has one variant per node kind instead of one per category, soNode::Type(RegisteredTypeNode::StructField(field))becomesNode::StructFieldType(field)andNode::ContextualValue(RegisteredContextualValueNode::Pda(pda))becomesNode::PdaValue(pda). A newNodeRefenum borrows any node with the same variants, so a tree can be walked without cloning it. Every node and node union converts intoNodeandNodeRef, and back fromNodewithtry_from. Deserialising a node of an unknown kind now names that kind in the error.Inject contextual defaults from
field(...)and reject ambiguous fieldsA contextual default such as
default_value = payerwritten in afield(...)directive on an instruction is now injected through aprovidesentry, like a default written on a Rust field. Contextual defaults outside an instruction, two fields of a struct whose identifiers share the same camelCase form, and adefault_valuenext to anaccount(...)directive are now errors instead of being dropped or accepted.Make
CodamaErrornon-exhaustiveNew error variants can now be added in minor releases, so a
matchonCodamaErroroutside this crate needs a wildcard arm.Merge enum variant types and port value nodes to spec v2
The empty, tuple and struct enum variant types are replaced by a single
EnumVariantTypeNodewhose optionaldatacan be any type node, and anEnumValueNodepayload can now be any value node rather than anEnumValuePayload. Number values split intoIntegerValueNodeandFloatValueNode. Instruction arguments are referenced with aDataValueNodeholding a validatedPath, which replacesArgumentValueNode, andAccountDataValueNodereplacesAccountFieldValueNode.Name the file in filesystem and manifest errors
CodamaError::FilesystemandCodamaError::Manifestnow carry thepathof the file that could not be accessed or parsed alongside theirsource, which is also the cause of the error. A bare OS error is replaced by one naming the file:They are no longer built with
From, andCodamaError::UnexpectedNodeis merged intoUnexpectedNodeKind.CodamaError::to_compile_errornow emits acompile_error!for every variant rather than nothing for those without a span.Point attribute errors at their cause
A number in
default_value = ...too large or too small for any integer now says so rather thanunrecognized value, and a Rust name that yields no valid identifier, such asété, explains why and suggests setting one withidentifier = "...". Code matching on these messages needs updating.Regenerate the nodes from spec v2
Node structs now follow spec v2: every node carries
plugins, type nodes carrytransformsin place of the v1 wrapper nodes, andNumberTypeNode/NumberValueNodeare replaced byIntegerTypeNode,FloatTypeNode,FixedPointTypeNode,DurationTypeNode,IntegerValueNodeandFloatValueNode. Named nodes serialiseidentifierinstead ofname, nodes are no longerCopy, and the v1-only nodes (argumentValueNode,resolverValueNode,instructionArgumentNode, the three enum variant nodes,amountTypeNode,solAmountTypeNode) are removed.Reject PDA seeds that would otherwise be dropped
A seed linked to a field by name, such as
seed(name = "authority"), now fails with an error asking for an explicittype = ...when the field's Rust type has no Codama type, instead of silently leaving the seed out of the PDA. A nesteddata(...)path in the seed list of apda(...)value must also be named explicitly withseed("name", data(...)).Remove
Docs::pushDocsno longer has apushmethod. Build docs from aVec<String>or aTextinstead, e.g.Docs::from(vec!["First line".to_string()]).Call the identifiers of directives
identifierand parse encodings as bare pathsThe
namefield ofAccountDirective,FieldDirective,ProgramDirective,EnumDiscriminatorDirective,CodamaProgramMacroandSeedDirectiveType::Variableis renamedidentifier, as it holds anIdentifierand the attributes already sayidentifier = "...". An encoding is written as a bare path everywhere, sodiscriminator(bytes = "...", encoding = utf8)replacesencoding = "utf8", likestring(encoding = utf8)and#[codama(encoding = utf8)]already were, and an invalid one lists the accepted encodings. Theassert_type!and sibling test macros are no longer exported. The error for apda(...)directive expected elsewhere namedseedand now namespda. The v1encoding = "utf8"points toencoding = utf8.Rename the
namefield of nodes toidentifierFollowing spec v2, the 22 nodes that identify themselves by a name now expose that name as
identifierrather thanname, and theHasNametrait becomesHasIdentifierwith anidentifier()method. In Rust code, this affects plugins and any code constructing or reading nodes directly.Replace
amountandsol_amountwithfixed_point, and adddurationand ticksamount(number(u64), 6, "USDC")becomesfixed_point(integer(u64), scale = 6, unit = "USDC"), with an optionalbase, andsol_amount(...)becomesfixed_point(..., scale = 9, unit = "SOL").integer(...)andfloat(...)accept aunit,date_time(...)acceptsticks_per_second, and the newduration(...)type describes time spans. Usingamount(...)orsol_amount(...)fails with a hint pointing to the replacement.Replace wrapper type nodes with transforms
Layout modifiers no longer wrap the type they apply to:
FixedSizeTypeNode,SizePrefixTypeNode,PreOffsetTypeNode,PostOffsetTypeNode,SentinelTypeNode,HiddenPrefixTypeNodeandHiddenSuffixTypeNodebecome the*TransformNodes of spec v2, attached to any type node or defined type link withadd_transform, e.g.StringTypeNode::utf8().add_transform(FixedSizeTransformNode::new(42)). Floats move to the newFloatTypeNode,FixedPointTypeNodeandDurationTypeNodeare added, andDateTimeTypeNodenow wraps anIntegerTypeNode.Turn the variants of accounts, events and instructions into items the same way
The visitors turning the variants of a
CodamaAccounts,CodamaEventsorCodamaInstructionsenum into program items share one way of numbering variants and reading their data, so tuple variants are accepted everywhere, including for accounts, and adefault_valueon a tuple item reaches the field it becomes, as it already did for instructions. A discriminator that would overflow au32is an error. Duplicate field identifiers are reported by the validator, once against their path, rather than also by the visitors;CombineTypesVisitorno longer exposes its fields, including the misspelledget_nammed_fieldandget_unnammed_field: configure it withnew,strict,allowing_contextual_default_valuesandwith_named_field.Simplify enum value constructors and directive checks
EnumValueNodenow has two constructors:newbuilds a variant without data, andwith_valuebuilds a variant with any value as its data. The previousempty,fieldsandtupleconstructors are removed.Attributes::has_codama_attributeis replaced byAttributes::has, which takes a directive filter such asSkipDirective::filterinstead of a directive name. Invalid identifiers in attributes now point at the string itself. Variable seeds are now validated when the attribute is parsed, soSeedDirectiveType::Variableholds anIdentifier.Split
numberintointegerandfloat, and replaceargumentwithfieldanddataWrite
integer(...)orfloat(...)wherever you usednumber(...), including insize = ...andprefix = .... Instruction arguments are declared as data fields withfield(...), values that read from instruction data usedata(...), which also accepts nested paths such asdata("config.fees[0]"), andremaining_accounts(argument("x"), ...)becomesremaining_accounts("x", ...). Amount displays now requiredecimals, and enum variants accept any payload type. Using a removed spelling fails with a hint pointing to its replacement.Mark every union and enum as non-exhaustive and name inline union variants after their node
Every generated union and enumeration, such as
ValueNode,TransformNode,IntegerFormatandIsSigner, as well asTypeNodeandRegisteredTypeNode, is now#[non_exhaustive]likeNode, so a member that a minor spec version adds is not a breaking change. Matches outside ofcodama-nodesneed a wildcard arm. The variants of the inline unions keep the whole name of their node likeNodedoes, soPdaSeedValueValue::Accountis nowPdaSeedValueValue::AccountValue, andRegisteredContextualValueNode::AccountisRegisteredContextualValueNode::AccountValue. The main union of each category still implies its category word, e.g.ValueNode::IntegerandLinkNode::Account.Start major 2
Release candidates of major 2 publish from
mainwhile it is in development. The stable release follows the ecosystem-wide release process.Update count, discriminator and display node constructors for spec v2
FieldDiscriminatorNodenow points at its field with aPath, validated against the spec path grammar like thepathofdataValueNodeandaccountDataValueNode, so a nested field such asheader.kindcan serve as a discriminator.AmountNumberDisplayNode::newrequiresdecimalsand no longer implementsDefault, andPrefixedCountNode::newtakes anIntegerTypeNode. New constructors are available forSentinelCountNode,UnitNumberDisplayNodeandValueLabelDisplayNode, along withIntegerTypeNode::{le, be}andIntegerValueNode::new.Update program, account and instruction nodes for spec v2
Instructions describe their payload with a single optional
datatype node, plus an optionalreturn_data, instead of a list of arguments. Accounts accept any type node as their data, remaining accounts are identified by name rather than carrying an argument or resolver value, and byte deltas use the spec v2 value nodes. Programs no longer have anorigin, error and status messages accept rich text, and plugin namespaces are validated, so invalid ones are rejected when deserialising.Use snake_case identifiers and replace
name = ...withidentifier = ...Identifiers derived from Rust code are now snake_case (
MyAccount→my_account,HTTPServer→http_server), whilst identifiers written in attributes, such asfield("x", ...),pda("...")oridentifier = "...", are kept exactly as written and must match the spec identifier grammar. References must therefore use the derived spelling, e.g.pda("my_pda")forstruct MyPda. Thename = "..."key becomesidentifier = "...", with a hint when the old key is used. In the Rust API,CamelCaseStringis replaced byIdentifier, which validates its value.Validate cyclic defined types without a finite value
Codama::get_idlnow fails when a defined type links back to itself such that every value nests another one, e.g.loop = struct { next: link(loop) }oralias = link(alias), since no codec can encode or decode it. Cycles with a way out, such as an option, an enum with another variant or a collection that may be empty, are still accepted.codama-visitors-coregainsis_defined_type_cyclic,has_defined_type_finite_value,get_defined_type_links_visitorandget_has_finite_value_visitor, like in the JavaScript library.Validate the PDA, instruction and instruction account links of the IDL
Codama::get_idlnow also fails when a PDA, instruction or instruction account link points to no node of its program, e.g.#[codama(pda = "vualt")]. Links naming a program that is not in the IDL point outside of it, such as the PDA of the associated token program, so they are not checked, and neither are account and defined type links to such programs.Validate paths, contextual values, interpolated intents and value labels
Codama::get_idlnow also fails when a field discriminator path does not point to a struct field of the data it identifies, when a data, account or account data value does not resolve within its instruction, when an interpolated intent has an invalid or unresolvable placeholder, and when a value label is not a concrete value of the type of its field.codama-visitors-coregainsresolve_type_pathandis_value_node_of_type, andcodama-nodesgainsPath::segments,parse_interpolated_intentandprint_interpolated_intent, like in the JavaScript library.Validate the default values of instruction inputs
Codama::get_idlnow also fails when the default values of an instruction depend on each other in a cycle or on an account or data field that the instruction does not have, when a data field defaults to the bump of an account that may be a signer, and when an injected value is neither provided nor given a fallback.codama-visitors-coregainsget_resolved_instruction_inputsandget_instruction_data_fields, like in the JavaScript library. The former fails with aResolveInstructionInputsErrorthat keeps the node paths and the dependency involved, so callers can match on them, and converts into aCodamaErrorfor?.Validate the IDL with
codama-validatorsA new
codama-validatorscrate lists the validation items of a Codama tree, like@codama/validatorsin the JavaScript library: missing identifiers, identifier collisions, links to missing nodes, programs without a public key, and more.Codama::get_idlandCodama::get_nodenow run it and fail withFailedToValidateNode, which lists every item, when any item is an error. In particular, a crate must now declare its program address, for example with[package.metadata.solana] program-id = "...". The CLI prints the message of an error rather than its debug representation.Walk koroks with
walk_*functions, likesyn::visit_mutEvery
KorokVisitormethod now defaults to the matchingwalk_*function, such aswalk_struct(visitor, korok), which a visitor handling a korok itself calls to keep walking.KorokVisitor::visit_childrenandKorokVisitable::get_children, which walked a parallel list of children, are removed;walk_korok_mutwalks the children of anyKorokMut.KorokMutgains theImplvariant it lacked, soUniformVisitorandDebugVisitorvisitimplblocks, andComposeVisitorforwards every method to its visitors, includingvisit_constandvisit_type_alias, which it used to walk on its own. TheKorokPlugintrait and its phases are documented.Features
Add the
codama-visitors-corecrateA new
codama-visitors-corecrate visits and transforms Codama nodes, like@codama/visitors-corein the JavaScript library. AVisitorreturns a value for each node, withIdentityVisitor,MergeVisitorandVoidVisitoras bases and adapters such asextend,tap,map,non_nullandrecord_node_stackto build on them.NodeStack,NodePathandLinkableDictionarytrack the visited path and resolve link nodes.NodeRefgainschildren,map_childrenandidentifier, and converts back into a reference to its node withtry_from.Emit float values for numbers written at float positions
A whole number such as
default_value = 1on a float field, constant, discriminator or PDA seed now produces afloatValueNoderather than anintegerValueNode, following links to find the type, so the output matches spec v2 and@codama/upgrade. The default plugin runs this pass withTransformIntegersToFloatsVisitor, and its logic is available astransform_integers_to_floats(&root), so a plugin that adds values later can run it again.List the expected node kinds in errors
Nodes and node unions now implement
NodeKinds, whoseKINDSconstant lists the node kinds they can hold, like the*_KINDSconstants of the JavaScript library.ProvidedScopeuses it to name the expected kinds when a resolved value has the wrong kind, and reports a fallback of the wrong kind with a newUnexpectedNodeKinderror.Resolve injected values with
ProvidedScopecodama-visitors-coregainsProvidedScope, which holds theprovidedNodes visible at a point of the tree and resolves theinjectedValueNodes found there, like in the JavaScript library. Therecord_provided_scopeadapter keeps it in sync with a visit, andget_provided_scope_from_pathbuilds it from the instructions of a path.Fixes
Emit node attributes in spec declaration order
Nodes now serialise their attributes in the order the spec declares them, followed by
plugins, which matches the IDLs produced by@codamaJS. Only the order of keys in the JSON changes, not its content.Keep defaults and plugins that were silently dropped
An instruction field renamed with
type = field("...", ...)now keeps itsdefault_value, and the plugins set on a program by several modules are now merged by namespace rather than only keeping those of the first module.Report conflicting PDAs of account variants against their enum
Variants of a
#[derive(CodamaAccounts)]enum sharing an identical PDA now keep it once rather than adding it to the program for each variant, and variants describing a PDA of the same identifier differently fail with an error pointing at the enum that declares them.Pin the crates to each other and declare the minimum Rust version
The crates of the workspace now depend on each other at their exact version, so a release candidate never resolves to a sibling from another candidate, and they declare Rust 1.83 as their minimum supported version.
codama-rs generate-idl -o <file>ends the file with a newline, like its output on stdout.Report unrecognized attributes consistently
An unknown key in
account(...)oraccount_bump(...), such asaccount(banana = "authority"), now fails withunrecognized attributelike every other directive, rather thanonly 'identifier' attribute supported. Withininteger(...)andfloat(...), the error now underlines the whole unrecognized attribute, such asfoo = 42rather thanfooalone, and a value that is not a path, such asinteger(u64, "slots"), also fails withunrecognized attributerather thanexpected a path.